home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / PredatorPrey / calc_inits.c < prev    next >
Text File  |  1996-06-22  |  36KB  |  1,356 lines

  1.     
  2.             /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
  3.             /*                                                               */
  4.             /*                    Prototype HP15C Calculator                */
  5.             /*                    James C. Ullrey                            */
  6.             /*                    INRESCO                                    */
  7.             /*                    © 1990                                    */
  8.             /*                    Version    13.97a                            */
  9.             /*                                                               */
  10.             /*                    INITS SEGMENT                               */
  11.             /*                                                               */
  12.             /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
  13.  
  14. /*****************************************************************/
  15. /*  I N C L U D E S
  16. /*****************************************************************/
  17.  
  18. #ifndef __C14__
  19. #include    "PredatorPrey.h"
  20. #endif
  21. #include    "create_prey.h"
  22. #include     "Globals.h"
  23. #ifndef __RED__
  24. #include     "ResourceDefs.h"
  25. #endif
  26. #include     "EventLoop.h"
  27. #include    "FileM.h"
  28. #ifndef __CIN__
  29. #include    "calc_inits.h"
  30. #endif
  31.  
  32. #include     <Quickdraw.h>
  33. /*#include    "calc_prog_list.h"*/
  34. #include    <LowMem.h>
  35. #include    <OSUtils.h>
  36. #include    <Traps.h>
  37. #include     "DialogAids.h"
  38. #include    "calc_update.h"
  39. //#include    <SysEqu.h>
  40.  
  41. #define     OKButton        1 
  42. #define     CancelButton    2 
  43. #define     Field4            4 
  44. #define     Field6            6 
  45. #define     Field8            8
  46. #define     PreRegister        10 
  47.  
  48. /********************************************************************
  49. /*  G L O B A L   V A R I A B L E   D E C L A R A T I O N S
  50. /********************************************************************/
  51.  
  52. extern    Str255        bufferOne;
  53. extern    Str255        bufferTwo;
  54. extern    Str255        bufferTwe;
  55. extern    long        gState;
  56. extern    long        gsState;
  57. extern    long         sto;
  58. extern    long         rcl;
  59. /*extern    long     gNewNum;*/
  60. /*extern    long     canClear;*/
  61. extern    long         gRoll;
  62. extern    long         wait;
  63. extern    long         gFlag;
  64. extern    long         fFlag;
  65. extern    long         sWait;
  66. extern    long         rWait;
  67. extern    long         lblWait;
  68. extern    long         plus;
  69. extern    long         minus;
  70. extern    long         timesF;
  71. extern    long         divide;
  72. extern    long         gDot;
  73. /*extern    long     rsFlag;*/
  74. extern    long        gDigits;
  75. /*extern    long    runMode;*/
  76. /*extern    long    gsbWait;*/
  77. extern    long        gtoWait;
  78. extern    Cursor        fingerCursor;
  79. extern    Cursor        questCursor;
  80. extern    Boolean        useColor[7];
  81. extern    double_t        thisIsFucked;
  82. extern    Point        theNoColorPoint;
  83. extern    Point        theTmNoColorPoint;
  84. extern    WindowPtr    gMy_windows[];
  85. extern    Ptr            gPre_allocated_block;
  86. extern    short        gWindow_count;
  87.  
  88. extern    Rect        gArrow_box;
  89. extern    Rect        gCircle_box;
  90. extern    Rect        gSquare_box;
  91. extern    Rect        gCube_box;
  92. extern    Rect        gHouse_box;
  93. extern    Rect        gBackGrnd_box;
  94.  
  95. extern    Rect        gPalette_frame;
  96. extern    Rect        gRotation_frame;
  97. extern    Rect        gMovement_frame;
  98. extern    Rect        gPlaneControl_frame;
  99.  
  100. extern    Rect        gXrotation_box;
  101. extern    Rect        gYrotation_box;
  102. extern    Rect        gZrotation_box;
  103. extern    Rect        gNegXrotation_box;
  104. extern    Rect        gNegYrotation_box;
  105. extern    Rect        gNegZrotation_box;
  106.  
  107. extern    Rect        gXrot_text_box;
  108. extern    Rect        gYrot_text_box;
  109. extern    Rect        gZrot_text_box;
  110.  
  111. extern    Rect        gRot_OK_box;
  112. extern    Rect        gRot_Cancel_box;
  113.  
  114. extern    Rect        gDoManyRotation_box;
  115.  
  116. extern    Rect        gDoRotateLeft_box;
  117. extern    Rect        gDoRotateRight_box;
  118. extern    Rect        gDoRotateUp_box;
  119. extern    Rect        gDoRotateDown_box;
  120. extern    Rect        gDoMoveIn_box;
  121. extern    Rect        gDoMoveOut_box;
  122.  
  123. extern    Rect        gDoPitchUp_box;
  124. extern    Rect        gDoPitchDn_box;
  125. extern    Rect        gDoYawLft_box;
  126. extern    Rect        gDoYawRt_box;
  127. extern    Rect        gDoBankLft_box;
  128. extern    Rect        gDoBankRt_box;
  129.  
  130. extern    Rect        gStretch_frame;
  131. extern    Rect        gXstretch_box;
  132. extern    Rect        gYstretch_box;
  133. extern    Rect        gZstretch_box;
  134. extern    Rect        gNegXstretch_box;
  135. extern    Rect        gNegYstretch_box;
  136. extern    Rect        gNegZstretch_box;
  137. extern    Rect        gXstr_text_box;
  138. extern    Rect        gYstr_text_box;
  139. extern    Rect        gZstr_text_box;
  140. extern    Rect        gStr_OK_box;
  141. extern    Rect        gStr_Cancel_box;
  142. extern    Boolean        scrapDirty;
  143.         /*EventRecord    curEvent;*/
  144.         /*WindowPtr    curWindow;*/
  145. extern    WinInfoPtr    cur;
  146. extern    WinInfoRec    noCur;
  147. extern    Boolean        preRegistered;
  148.         int            defaultFont,defaultFontSize;
  149. extern    short        kNumMyHelpItems;
  150. extern    WindowPtr    lastPtr;
  151. /*****************************************************************/
  152. /*  P R O T O T Y P E S
  153. /*****************************************************************/
  154.  
  155.  
  156.         
  157.         void        InitFileMD            (void);
  158.         void        InitFileMP            (void);
  159. //        Boolean        trap_available        (short trap_number,
  160. //                                        unsigned char trap_type);
  161.         Boolean        trap_available        (short trap_number,
  162.                                         TrapType trap_type);
  163.                                 
  164.         Boolean        WNE_is_implemented    (void);
  165.         Boolean        GetEnvir            (short *vRef);
  166.         WindowPtr    make_circle_window    (short    selector);
  167.         void        SetInfo                (WindowPtr    window);
  168.         void        UpdateMainWindow    (void);
  169.         void        DrawClippedGrow     (    short            x,
  170.                                              short            y
  171.                                          );
  172.         Boolean     GetShare            (ShareRec    *Share);        
  173. static     Handle        GetItemHandle        (short        itemNr);
  174. //extern    void        DoPreReg            (short    n,short    m);
  175. /*****************************************************************/
  176. /*****************************************************************/
  177. /*
  178. /* R O U T I N E S
  179. /*
  180. /*****************************************************************/
  181. /*****************************************************************/
  182.  
  183. void    inits_seg() {}        /*  for reference in "UnloadSeg()" calls    */
  184.  
  185.  
  186. /*****************************************************************/
  187. /*  I N I T   R O M   -   Initialize ROM Managers.
  188. /*****************************************************************/
  189.  
  190.  
  191. void init_ROM()
  192. {
  193.  
  194.  
  195. /*******************    Memory Manager "initializations"    ******************/
  196.  
  197.     /* These calls really SHOULD be done by every application. */
  198.  
  199.     DoSetStackSize();
  200.     MaxApplZone();                /* grow the heap to its maximum size */
  201.     MoreMasters();                   /* create more master pointers         */
  202.     MoreMasters();                   /* create more master pointers         */
  203.     MoreMasters();                   /* create more master pointers         */
  204.     MoreMasters();                   /* create more master pointers         */
  205.     MoreMasters();                   /* create more master pointers         */
  206.     MoreMasters();                   /* create more master pointers         */
  207.     
  208. /*******************    ROM Manager initializations            ******************/
  209.  
  210.     InitGraf( &qd.thePort );   /* Initializes QuickDraw  */
  211.     InitFonts();
  212.     InitWindows();
  213.     InitMenus();
  214.     TEInit();
  215.     InitDialogs( NIL_POINTER );
  216.  
  217. /****************   Event Loop and Cursor initialization    ******************/
  218.  
  219.     FlushEvents(everyEvent,REMOVE_ALL_EVENTS);    /* clear the Event queue of all events     */
  220.     InitCursor();                                /* set the cursor to arrow instead of clock    */
  221.     defaultFont = monaco;
  222.     defaultFontSize = 9;
  223.     InitFileMD ();
  224.     InitFileMP ();
  225.     InitFileMB ();
  226.  
  227. }     /* end of init_ROM */
  228.  
  229.  
  230. /********************** GetEnvir ************************/
  231. Boolean        GetEnvir( short    *vRef )
  232. {
  233.     OSErr        status;
  234.     SysEnvRec    SysEnvData;
  235.     /*GDHandle    theGD;*/
  236.     GDHandle    theGD[7];
  237.     short        result;
  238.     short        gdDevType[7];
  239.     short        i;
  240.     
  241.     
  242.     //for(i = 0;i <= 6; i++)
  243.     //{
  244.     //    useColor[i] = 1;
  245.     //    /*gdDevType[i] = 1;*/
  246.     //}
  247.     status = SysEnvirons( SYS_VERSION, &SysEnvData ); /*SysEnvirons, V-5*/
  248.     if (( status != noErr ) || ( SysEnvData.systemVersion < 0x0600 ))
  249.     {
  250.         StopAlert( BAD_SYS_ALERT, NIL_POINTER );
  251.         result = FALSE;
  252.     }
  253.     else
  254.     {
  255.         *vRef = SysEnvData.sysVRefNum;
  256.         result = TRUE;
  257.     }
  258.     if ((SysEnvData.machineType > 0) && SysEnvData.hasColorQD)
  259.     {
  260.         
  261.         theGD[0] = GetMainDevice();
  262.         /*    SetDeviceAttribute(theGD[0],0,1);    */
  263.                                             /*    sys 6    */
  264.         useColor[0] = TestDeviceAttribute (theGD[0], 0);
  265.         i = 0;
  266.         do
  267.         {
  268.             theGD[i+1] = GetNextDevice(theGD[i]);
  269.             if(theGD[i+1] != NIL)
  270.                 useColor[i+1] = TestDeviceAttribute (theGD[i+1], 0);
  271.             i++;
  272.         }
  273.         while(theGD[i] != NIL);
  274.     }
  275.     return( result);
  276. }        /* NOTE:    "#define    SYS_VERSION            1"    from calculator.h    */
  277.  
  278.  
  279. /********************** MenuBarInit ************************/
  280. void MenuBarInit()
  281. {
  282.     Handle        myMenuBar;
  283.     Boolean        checkIt = FALSE;
  284.     OSErr        myErr;
  285.     MenuHandle    myHelpMenuHandle;
  286.     Str255        itemString;
  287.     
  288.     myMenuBar = GetNewMBar( BASE_RES_ID );
  289.     SetMenuBar( myMenuBar );
  290.     gAppleMenu = GetMHandle( APPLE_MENU_ID );
  291.     AddResMenu( gAppleMenu, 'DRVR' );
  292.     gFileMenu = GetMHandle( FILE_MENU_ID );    /* gFileMenu is a global defined in Calculator.h */
  293.     gEditMenu = GetMHandle( EDIT_MENU_ID );
  294.     //gWindowMenu = GetMHandle( WINDOW_MENU_ID );
  295.     //gProgMenu = GetMHandle( PROGRAM_MENU_ID );
  296.     gGraphMenu = GetMHandle( GRAPHICS_MENU_ID );    /*    405    */
  297.     myErr = HMGetHelpMenuHandle(&myHelpMenuHandle);
  298.     if(myErr == noErr)
  299.     {
  300.         if(myHelpMenuHandle != nil)
  301.         {
  302.             kNumMyHelpItems = CountMItems(myHelpMenuHandle);
  303.             GetIndString(itemString, kMyStrings, kCalcHelp);
  304.             AppendMenu(myHelpMenuHandle, itemString);
  305.             GetIndString(itemString, kMyStrings, kAltCalcHelp);
  306.             AppendMenu(myHelpMenuHandle, itemString);
  307.         }
  308.     }
  309.     gGrafType = GetMenu( 100 );
  310.     
  311.     InsertMenu( gGrafType, -1 );
  312.     
  313.     gDorkMenu = GetMHandle( DORK_MENU_ID );
  314.     DisableItem(GetMHandle(FILE_MENU_ID), 1);
  315.     //DisableItem(GetMHandle(FILE_MENU_ID), 6);
  316.     //DisableItem(GetMHandle(FILE_MENU_ID), 7);
  317.     //DisableItem(GetMHandle(FILE_MENU_ID), 12);
  318.     /*DisableItem(GetMHandle(WINDOW_MENU_ID), 1);*/
  319.     DrawMenuBar();    
  320. }
  321.  
  322.  
  323.  
  324.  
  325. /********************** WindowInit ************************/
  326. void    WindowInit()
  327. {
  328.     short    n;
  329.     Str255    pFName = "\p";
  330.     Str255    qFName = "\p";
  331.     short    vRefNum = 0;
  332.     short    pRefNum = 0;
  333.     short    qRefNum = 0;
  334.  
  335.     /*** Globals initializations ***/
  336.                                             /*    MY_WINDOW_MAX = 5        */
  337.     for(n = 0; n <= MY_WINDOW_MAX; n++)        /* array is MAX+1 in size    */
  338.         gMy_windows[n] = NIL;                /* clear window pointers    */
  339.  
  340.  
  341.     SetRect(&gArrow_box, -1, -1, 31, 31);        /* Set up palette boxes' borders */
  342.  
  343.     SetRect(&gCircle_box, -1, 29, 31, 61);
  344.                         
  345.     SetRect(&gSquare_box, -1, 59, 31, 91);
  346.     
  347.     SetRect(&gCube_box, -1,    89, 31, 121);
  348.     
  349.     SetRect(&gHouse_box, -1, 119, 31, 151);
  350.     
  351.     SetRect(&gBackGrnd_box, -1, 149, 31, 181);
  352.  
  353.     SetRect(&gPalette_frame, -1, -1, 31, 181);
  354.     /**********************  L,  T,  R,  B  *******/    
  355.     SetRect(&gXrotation_box, -1, -1, 31, 31);
  356.     SetRect(&gYrotation_box, -1, 29, 31, 61);
  357.     SetRect(&gZrotation_box, -1, 59, 31, 91);
  358.  
  359.     SetRect(&gNegXrotation_box, 29, -1, 61, 31);
  360.     SetRect(&gNegYrotation_box, 29, 29, 61, 61);
  361.     SetRect(&gNegZrotation_box, 29, 59, 61, 91);
  362.  
  363.     SetRect(&gDoManyRotation_box,89,29,121,61);
  364.     
  365.     SetRect(&gMovement_frame,-1,89,61,181);
  366.     SetRect(&gPlaneControl_frame,59,89,121,181);
  367.  
  368.     SetRect(&gDoRotateLeft_box,-1,89,31,121);
  369.     SetRect(&gDoRotateRight_box,29,89,61,121);
  370.     SetRect(&gDoRotateUp_box,-1,119,31,151);
  371.     SetRect(&gDoRotateDown_box,29,119,61,151);
  372.     SetRect(&gDoMoveIn_box,-1,149,31,181);
  373.     SetRect(&gDoMoveOut_box,29,149,61,181);
  374.     
  375.     SetRect(&gDoPitchUp_box,59,89,91,121);
  376.     SetRect(&gDoPitchDn_box,89,89,121,121);
  377.     SetRect(&gDoYawLft_box,59,119,91,151);
  378.     SetRect(&gDoYawRt_box,89,119,121,151);
  379.     SetRect(&gDoBankLft_box,59,149,91,181);
  380.     SetRect(&gDoBankRt_box,89,149,121,181);
  381.     
  382.  
  383.     SetRect(&gXrot_text_box, 121, 6, 181, 20);
  384.     SetRect(&gYrot_text_box, 121, 38, 181, 52);
  385.     SetRect(&gZrot_text_box, 121, 70, 181, 94);
  386.  
  387.     SetRect(&gRot_OK_box, 241, 6, 291, 20);
  388.     SetRect(&gRot_Cancel_box, 241, 38, 291, 52);
  389.  
  390.     SetRect(&gRotation_frame, -1, -1, 61, 91);
  391.     
  392.     SetRect(&gXstretch_box, -1, -1, 31, 31);
  393.     SetRect(&gYstretch_box, -1, 29, 31, 61);
  394.     SetRect(&gZstretch_box, -1, 59, 31, 91);
  395.  
  396.     SetRect(&gNegXstretch_box, 29, -1, 61, 31);
  397.     SetRect(&gNegYstretch_box, 29, 29, 61, 61);
  398.     SetRect(&gNegZstretch_box, 29, 59, 61, 91);
  399.  
  400.  
  401.     SetRect(&gXstr_text_box, 121, 6, 181, 20);
  402.     SetRect(&gYstr_text_box, 121, 38, 181, 52);
  403.     SetRect(&gZstr_text_box, 121, 70, 181, 94);
  404.  
  405.     SetRect(&gStr_OK_box, 241, 6, 291, 20);
  406.     SetRect(&gStr_Cancel_box, 241, 38, 291, 52);
  407.  
  408.     SetRect(&gStretch_frame, -1, -1, 61, 91);
  409.  
  410.     /**************** Get room for a WindowPtr in low heap ********************/
  411.     
  412.     gPre_allocated_block = NewPtr(sizeof(CWindowRecord));
  413.     if(gPre_allocated_block == NIL)
  414.     {
  415.         #ifdef      powerc
  416.             StopAlert(OUT_OF_MEM,    (UniversalProcPtr)NIL);
  417.         #else
  418.             StopAlert(OUT_OF_MEM,    NIL);
  419.         #endif      /* powerc */
  420.         ExitToShell();
  421.     }
  422.     
  423.     
  424.     //SetPort( gCalcWindow );
  425.     //SetNewInfo(gCalcWindow);
  426.     
  427.  
  428.     cur->pFileNum    = pRefNum;        /* program file refNum */
  429.  
  430.  
  431.     cur->qFileNum    = qRefNum;        /* data file refNum */
  432.  
  433.     cur->volNum        = vRefNum;
  434.     cur->pDirty        = false;
  435.     cur->qDirty        = false;
  436.     cur->pFilename    = NewString (pFName);
  437.     cur->qFilename    = NewString (qFName);
  438.     cur->windowKind = WMainWindow;
  439.     ((WindowPeek) curWindow)->windowKind = userKind + WMainWindow;
  440.     cur->witlHandle = GetResource ('Witl', MainWindowID);
  441.     cur->wictHandle = GetResource ('Wict', MainWindowID);
  442.  
  443.     
  444.     cur->text = nil;
  445.         
  446.     //ShowWindow( gCalcWindow );
  447. }
  448.  
  449. /********************** LoadPicture ************************/
  450. void    LoadPicture()
  451. {
  452.     gSkullPicture30 = GetPicture( BASE_RES_ID+12 );
  453.     gSkullPicture35 = GetPicture( BASE_RES_ID+13 );
  454.     gSkullPicture40 = GetPicture( BASE_RES_ID+14 );
  455.     gSkullPicture45 = GetPicture( BASE_RES_ID+15 );
  456.     gSkullPicture50 = GetPicture( BASE_RES_ID+16 );
  457.     gSkullPicture55 = GetPicture( BASE_RES_ID+17 );
  458.     gSkullPicture60 = GetPicture( BASE_RES_ID+18 );
  459.     gSkullPicture65 = GetPicture( BASE_RES_ID+19 );
  460.     gSkullPicture70 = GetPicture( BASE_RES_ID+20 );
  461.     gSkullPicture75 = GetPicture( BASE_RES_ID+21 );
  462.     gSkullPicture80 = GetPicture( BASE_RES_ID+22 );
  463.     gSkullPicture85 = GetPicture( BASE_RES_ID+23 );
  464.     gSkullPicture90 = GetPicture( BASE_RES_ID+24 );
  465.     gSkullPicture95 = GetPicture( BASE_RES_ID+25 );
  466.     gSkullPicture100 = GetPicture( BASE_RES_ID+26 );
  467. }
  468.  
  469.  
  470. /*********************** SetUpCursors *************************/
  471. void SetUpCursors(void)
  472. {
  473.     CursHandle    hCurs;
  474.     
  475.     hCurs = GetCursor(BASE_RES_ID);
  476.     fingerCursor = **hCurs;
  477.     hCurs = GetCursor(BASE_RES_ID+1);
  478.     questCursor = **hCurs;
  479. }
  480.  
  481. /********************** SetUpDragRect ************************/
  482. void    SetUpDragRect()
  483. {
  484.     RgnHandle    theRgn;                            /*    see: RectRgn, DiffRgn    */
  485.                                                 /*    NewRgn,EmptyRgn    */
  486.     theRgn = GetGrayRgn();
  487.     gDragRect = (**theRgn).rgnBBox;                /*    Rect    gDragRect;    */
  488.     gNoColorDragRect = qd.screenBits.bounds;
  489.     /*gNoColorDragRect.left += DRAG_THRESHOLD;*/
  490.     /*gNoColorDragRect.right -= DRAG_THRESHOLD;*/
  491.     /*gNoColorDragRect.bottom -= DRAG_THRESHOLD;*/
  492. }
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499. /************************************************************************************/    
  500. /*    RectRgn( theRgn, &theRect );  converts the rgn to a rect    IV I-183            */
  501. /*    InvalRgn( badRgn ); forces an update of a rgn, in local window coords            */
  502. /*    DiffRgn( srcRgnA, srcRgnB, destRgn ); the difference of rgnA & rgnB -> dest     */
  503. /*    SectRgn( srcRgnA, srcRgnB, destRgn ); the intersection of rgnA & rgnB -> dest    */
  504. /*        IM I-184                                                                    */
  505. /*    if( EmptyRgn( theRgn ) ) {        after a SectRgn call, test for no intersection    */
  506. /*    if( RectInRgn( &theRect, theRgn ) ) {        check if a rect intersects a rgn    */
  507. /*    XorRgn( srcRgnA, srcRgnB, destRgn ); find the union, less intersect of 2 rgns    */
  508. /*    visRgn         RgnHandle:hndl to a rect region coincident with screenBits.bounds    */
  509. /*    portRect    Rect        screenBits.bounds                                        */
  510. /*    GDevice    structure - has essential info                                            */
  511. /*    BitMap    portBits.bounds of grafPort                                                */
  512. /*    RectInRgn    IM I-185                                                            */
  513. /*    SectRect    IM I-175                                                            */
  514. /************************************************************************************/    
  515.  
  516.  
  517. /********************** SetUpButtonRect ************************/    
  518. void    SetUpButtonRect()
  519. {
  520.     /* SetRect( theRect, rLeft, rTop, rRight, rBottom); */
  521.     
  522.  
  523.  
  524.     
  525.     
  526.     SetRect( &gSkullRect30,354,20,402,63 );
  527.     SetRect( &gSkullRect35,329,19,404,79 );
  528.     SetRect( &gSkullRect40,304,18,406,95 );
  529.     
  530.     SetRect( &gSkullRect45,279,17,408,111 );
  531.     SetRect( &gSkullRect50,254,15,410,127 );
  532.     SetRect( &gSkullRect55,229,13,412,143 );
  533.     SetRect( &gSkullRect60,203,11,415,160 );
  534.     
  535.     SetRect( &gSkullRect65,177,9,418,177 );
  536.     SetRect( &gSkullRect70,151,7,421,194 );
  537.     SetRect( &gSkullRect75,125,5,424,211 );
  538.     SetRect( &gSkullRect80,100,4,427,228 );
  539.     
  540.     SetRect( &gSkullRect85,75,3,429,244 );
  541.     SetRect( &gSkullRect90,50,2,431,260 );
  542.     SetRect( &gSkullRect95,25,1,433,276 );
  543.     SetRect( &gSkullRect100,0,0,435,295 );
  544.     
  545.     SetRect( &gDisplayRect, 50,23,333,54 );
  546.     SetRect( &gHPRect, 357,23,399,46 );
  547.     SetRect( &g1499Rect, 357,50,399,60 );
  548.  
  549.     
  550.     SetPt(&theNoColorPoint,BTN_LFT+91,BTN_TOP+157);
  551.     /*theNoColorPoint->h = BTN_LFT+91;*/
  552.     /*theNoColorPoint->v = BTN_TOP+157;*/
  553.     
  554. }    /*            * end of SetUpButtonRect *            */        
  555.  
  556. /********************* SetUpNewButtonRect **********************/    
  557. void    SetUpNewButtonRect()
  558. {
  559.     /* SetRect( theRect, rLeft, rTop, rRight, rBottom); */
  560.  
  561.     SetPt(&theTmNoColorPoint,NBTN_LFT+80,NBTN_TOP+150);
  562.  
  563.     /* SetRect( theRect, rLeft, rTop, rRight, rBottom); */
  564.     
  565. }    /*            * end of SetUpNewButtonRect *            */
  566.  
  567. void    SetUpHelpRect(void)
  568. {
  569. /* SetRect( theRect, rLeft, rTop, rRight, rBottom); */
  570.         
  571.  
  572.  
  573.     /* SetRect( theRect, rLeft, rTop, rRight, rBottom); */
  574.  
  575. }
  576. /*********************** CenterWindow ****************************/
  577. /*****************************************************************/
  578. void CenterWindow( WindowPtr wptr ) 
  579. /* Calculates left, top position of center & moves window */
  580. {
  581.     short        scrW, scrV;
  582.     Rect        scrRect;
  583.     Point        where;
  584.     
  585.     WinRect( wptr, &scrRect );    // Returns the window global coordinates in scrRect
  586.     scrW = qd.screenBits.bounds.right - qd.screenBits.bounds.left; // Calculates screen width
  587.     scrV = ( qd.screenBits.bounds.bottom - qd.screenBits.bounds.top ) - GetMBarHeight(); // Calculates screen height
  588.     where.v = ( scrV - ( scrRect.bottom - scrRect.top ) )/2; // Calculates top left vert coordinate
  589.     where.h = ( scrW - ( scrRect.right - scrRect.left ) )/2; // Calculates the top left horiz coordinate
  590.     MoveWindow( wptr, where.h, where.v, false ); // Moves window to new location
  591. }
  592.  
  593.  
  594.  
  595. /*****************************************************************/
  596. /*********************** splashScreen ****************************/
  597. /*****************************************************************/
  598. void SplashScreen (void) 
  599. {
  600.     WindowPtr    dPtr;
  601.     
  602.     GrafPtr        oldPort;
  603.     long        ticktime;
  604.     short        iType;
  605.     short        itemHit;
  606.     Handle        h;
  607.     PicHandle    hh;
  608.     Rect        box;
  609.     Boolean        notDone = TRUE;
  610.     ProcPtr        myFilter;
  611.         
  612.     if ( (dPtr = GetNewDialog(SPLASH_SCREEN, NIL_POINTER, (WindowPtr)MOVE_TO_FRONT) )
  613.                 != NIL_POINTER )
  614.     {
  615.         GetPort(&oldPort );    
  616. /*****************************************************************/
  617.         GetDItem(dPtr,2,&iType,&h,&box);
  618.         if(useColor[0])
  619.         {
  620.             SetDItem(dPtr,2,iType,h,&box);
  621.         }
  622.         else
  623.         {
  624.             hh = GetPicture(410);
  625.             SetDItem(dPtr,2,iType,(Handle)hh,&box);
  626.         }
  627.         
  628.         
  629. /*****************************************************************/
  630.         CenterWindow( dPtr );        
  631.         ShowHide( dPtr,TRUE );                        /* Make window visible if invisible */
  632.         SetPort( dPtr );                                    
  633.         DrawDialog(dPtr);
  634.         Delay (60L, &ticktime);                        /* wait 1 second ( 60 TICKS )  */        
  635.         DisposDialog (dPtr);                        /* Remove window from memory */
  636.         SetPort( oldPort );
  637. /*        DoAboutText( dPtr );*/
  638.     }
  639.     else
  640.     {
  641.         SysBeep (1);        // Sound the alarm
  642.         ExitToShell ();        /* probably can't open resource fork! */
  643.     }
  644. }
  645.  
  646.  
  647. static    void    DoShare(void)
  648. {
  649.     ShareRec    ShareInfo;
  650.     register     ShareRecPtr    info;
  651.     short        i,j;
  652.     
  653.     info = &ShareInfo;
  654.     info->Field4Text [0] = 0;
  655.     info->Field6Text [0] = 0;
  656.     info->Field8Text [0] = 0;
  657.     
  658.     if(GetShare (&ShareInfo))
  659.     {
  660.         /* use ShareInfo */
  661.         
  662.         if(info->Field4Text [0] != 0)
  663.         {
  664.             i = info->Field4Text [0];
  665.             for(j = 0;j<=i;j++)
  666.             {
  667.                 bufferOne[j] = info->Field4Text[j];
  668.             }
  669.         }
  670.         if(info->Field6Text [0] != 0)
  671.         {
  672.             i = info->Field6Text [0];
  673.             for(j = 0;j<=i;j++)
  674.             {
  675.                 bufferTwo[j] = info->Field6Text[j];
  676.             }
  677.         }
  678.         if(info->Field8Text [0] != 0)
  679.         {
  680.             i = info->Field8Text [0];
  681.             for(j = 0;j<=i;j++)
  682.             {
  683.                 bufferTwe[j] = info->Field8Text[j];
  684.             }
  685.         }
  686.     }    
  687. }
  688.  
  689. void    DoTheShare    (void)
  690. {
  691.     DoShare();
  692. }
  693.  
  694.  
  695.  
  696. Boolean    GetShare(ShareRec    *Share)
  697. {
  698.     GrafPtr            sOldPort;
  699.     DialogPtr        shrPtr;
  700.     Boolean            result;
  701.     Boolean            done;
  702.     short            itemNr;
  703.     short            n,m;
  704.     register         ShareRecPtr    info;
  705.     ModalFilterUPP    gMyStandardFilterProcUPP;
  706.  
  707.     if((shrPtr = GetNewDialog(SHR_SCRN,NIL_PTR,(WindowPtr)MOVE_TO_FRONT) ) != NIL_PTR )
  708.     {
  709.         GetPort(&sOldPort );    
  710.         SetPort( shrPtr );
  711.         info = Share;
  712.         SetDText (Field4, info->Field4Text);
  713.         SetDText (Field6, info->Field6Text);
  714.         SetDText (Field8, info->Field8Text);
  715.         CenterWindow( shrPtr );        /*    this    */
  716.         ShowHide( shrPtr,TRUE );                        /* Make window visible if invisible */
  717.         OutlineButton (1);
  718.                                             
  719.         DrawDialog(shrPtr);
  720.         gMyStandardFilterProcUPP = NewModalFilterProc(StandardFilter);
  721.         do
  722.         {
  723.             //ModalDialog(StandardFilter,&itemNr);
  724.             ModalDialog(gMyStandardFilterProcUPP,&itemNr);
  725.             switch (itemNr)
  726.             {
  727.                 case OKButton:
  728.                         result = true;
  729.                         done = true;
  730.                     break;
  731.                 case CancelButton:
  732.                         result = false;
  733.                         done = true;
  734.                     break;
  735.                 case PreRegister:
  736. /*****************************************************************/
  737. /*                        n = info->Field4Text[0];*/
  738. /*                        m = info->Field6Text[0];*/
  739. /*                        DoPreReg(n,m);*/
  740. /*                        SetDText (Field8, map.mem1name);*/
  741. /*****************************************************************/
  742.                         preRegistered = TRUE;
  743.                         result = true;
  744.                     break;
  745.                 case Field4:
  746.                         GetDText (itemNr, info->Field4Text);
  747.                     break;
  748.                 case Field6:
  749.                         GetDText (itemNr, info->Field6Text);
  750.                     break;
  751.                 case Field8:
  752.                         GetDText (itemNr, info->Field8Text);
  753.                     break;
  754.             }
  755.         }
  756.         while((itemNr != 1) && (itemNr != 2) && (itemNr != 10));
  757.         DisposDialog (shrPtr);                        /* Remove window from memory */
  758.         SetPort( sOldPort );
  759.         return (result);    
  760.     }
  761. }
  762.  
  763.  
  764. /*----------*/
  765. /*void SetDText        (short        itemNr,
  766.                      Str255        text)
  767. {
  768.     Handle            itemHandle;
  769.  
  770.     itemHandle = GetItemHandle (itemNr);
  771.     SetIText (itemHandle, text);
  772. }*/ /*SetDText*/
  773.  
  774. /*----------*/
  775. /*void GetDText        (short        itemNr,
  776.                      Str255        text)
  777. {
  778.     Handle            itemHandle;
  779.  
  780.     itemHandle = GetItemHandle (itemNr);
  781.     GetIText (itemHandle, text);
  782. } *//*GetDText*/
  783.  
  784. /*----------*/
  785.  
  786. static Handle    GetItemHandle    (short        itemNr)
  787. {
  788.     short        itemType;
  789.     Handle        itemHandle;
  790.     Rect        itemRect;
  791.  
  792.     GetDItem (qd.thePort, itemNr, &itemType, &itemHandle, &itemRect);
  793.  
  794.     return (itemHandle);
  795. } /*GetItemHandle*/
  796.  
  797. /*****************************************************************/
  798. /********************** StandardFilter ***************************/
  799. /*****************************************************************/
  800.  
  801.  
  802.  
  803. /*void OutlineButton    (short        itemNr)
  804. {
  805.     Rect            itemRect;
  806.     PenState        savePen;
  807.  
  808.     GetPenState (&savePen);
  809.     PenNormal ();
  810.     PenSize (3, 3);
  811.     itemRect = GetDRect (itemNr);
  812.     InsetRect (&itemRect, -4, -4);
  813.     FrameRoundRect (&itemRect, 16, 16);
  814.     SetPenState (&savePen);
  815. }*/ /*OutlineButton*/
  816.  
  817. /*void DoUpdate    ()*/
  818. /*{*/
  819. /*    GrafPtr            savePort;*/
  820. /*    WindowPtr        saveWindow;*/
  821. /*    WindowPtr        whichWindow;*/
  822. /**/
  823. /*    GetPort (&savePort);*/
  824. /*    whichWindow = (WindowPtr) curEvent.message;*/
  825. /*    SetPort (whichWindow);*/
  826. /*    saveWindow = curWindow;*/
  827. /*    SetInfo (whichWindow);*/
  828. /*    BeginUpdate (whichWindow);*/
  829. /*        EraseRect (&(whichWindow->portRect));*/
  830. /*        DrawControls (whichWindow);*/
  831. /*        UpdateContent ();*/
  832. /*    EndUpdate (whichWindow);*/
  833. /*    SetInfo (saveWindow);    */
  834. /*    SetPort (savePort);*/
  835. /*}*/ /*DoUpdate*/
  836.  
  837. /*----------*/
  838. /*Rect    GetDRect    (short        itemNr)
  839. {
  840.     short        itemType;
  841.     Handle        itemHandle;
  842.     Rect        itemRect;
  843.  
  844.     GetDItem (qd.thePort, itemNr, &itemType, &itemHandle, &itemRect);
  845.  
  846.     return (itemRect);
  847. }*/ /*GetDRect*/
  848.  
  849. /*void SetInfo (WindowPtr        window)*/
  850. /*{*/
  851. /*    WinInfoPtr        infoPtr;*/
  852. /**/
  853. /*    if (window != curWindow) {*/
  854. /*        curWindow = window;*/
  855. /*        if (curWindow != nil) {*/
  856. /*            infoPtr = (WinInfoPtr) GetWRefCon (curWindow);*/
  857. /*            cur = infoPtr;*/
  858. /*        } else {*/
  859. /*            cur = &noCur;*/
  860. /*        }*/
  861. /*    }*/
  862. /*} /*SetInfo»*/
  863.  
  864. /*void UpdateContent (void)*/
  865. /*{*/
  866. /*    switch (cur->windowKind) {*/
  867. /*        case WMainWindow:*/
  868. /*                UpdateMainWindow ();*/
  869. /*            break;*/
  870. /*        */
  871. /*    } /*switch»*/
  872. /*} /*UpdateContent»*/
  873.  
  874. void UpdateMainWindow (void)
  875. {
  876.     Rect            bounds;
  877.  
  878.     
  879.     DrawClippedGrow (-15, -15);
  880. } /*UpdateMainWindow*/
  881.  
  882.  
  883.  
  884. /*****************************************************************/
  885. /******************** end of StandardFilter **********************/
  886. /*****************************************************************/
  887.  
  888. /*pascal    Boolean    myFilter(DialogPtr shrPtr,EventRecord *event, short itemHit)*/
  889. /*/*DialogPtr         shrPtr;»*/
  890. /*/*EventRecord     *event;»*/
  891. /*/*short             itemHit;»*/
  892. /*{*/
  893. /*    char        key;*/
  894. /*    WindowPtr    wizPtr;*/
  895. /*    GrafPtr        wOldPort;*/
  896. /*    */
  897. /*    */
  898. /*    switch (event->what)*/
  899. /*    {*/
  900. /*        case    nullEvent:*/
  901. /*            return FALSE;*/
  902. /*            break;*/
  903. /*        case    keyDown:*/
  904. /*        case    autoKey:*/
  905. /*            key = event->modifiers & charCodeMask;*/
  906. /*            if(event->modifiers & cmdKey)*/
  907. /*                if ((key == 87) || (key == 119))*/
  908. /*                {*/
  909. /*                    if((wizPtr = GetNewDialog(WIZ_SCRN,NIL_PTR,(WindowPtr)MOVE_TO_FRONT) ) != NIL_PTR )*/
  910. /*                    {*/
  911. /*                        GetPort(&wOldPort );*/
  912. /*                        CenterWindow( wizPtr );*/
  913. /*                        ShowHide( wizPtr,TRUE );                        /* Make window visible if invisible »*/
  914. /*                        SetPort( wizPtr );                                    */
  915. /*                        DrawDialog(wizPtr);*/
  916. /*                        do*/
  917. /*                        {*/
  918. /*                            ModalDialog(NIL /* myFilter »,&itemHit);*/
  919. /*                        }*/
  920. /*                        while(itemHit != 5);*/
  921. /*                        DisposDialog (wizPtr);                        /* Remove window from memory »*/
  922. /*                        SetPort( wOldPort );*/
  923. /*                    }*/
  924. /*                }*/
  925. /*            return FALSE;*/
  926. /*        default:*/
  927. /*            return FALSE;*/
  928. /*    }*/
  929. /*}*/
  930. /*****************************************************************/
  931. /********************** trap_available ***************************/
  932. /*****************************************************************/
  933. /*
  934. //Boolean         trap_available(short trap_number,unsigned char trap_type)
  935. Boolean         trap_available(short trap_number,TrapType trap_type)
  936. //short            trap_number;
  937. //unsigned char    trap_type;
  938.  
  939. {
  940.     UniversalProcPtr    Ntrap_address;
  941.     UniversalProcPtr    trap_address;
  942.     
  943.     
  944.     Ntrap_address = NGetTrapAddress(trap_number, trap_type);
  945.     trap_address = GetTrapAddress(UNIMPLEMENTED);
  946.     //return(trap_address != GetTrapAddress(UNIMPLEMENTED) );
  947.     return(Ntrap_address != trap_address );
  948.  
  949. }*/    /* end of trap_available */
  950. /*----------*/
  951. /*Boolean TrapAvailable    (short            tNumber,
  952.                          TrapType        tType);
  953. Boolean TrapAvailable    (short            tNumber,
  954.                          TrapType        tType)
  955. {
  956.     return (NGetTrapAddress (tNumber, tType)
  957.             != GetTrapAddress (_Unimplemented));
  958. } *//*TrapAvailable*/
  959.  
  960.  
  961. /*****************************************************************/
  962. /****************** WNE_is_implemented ***************************/
  963. /*****************************************************************/
  964.  
  965. Boolean        WNE_is_implemented()
  966.  
  967. {
  968.     SysEnvRec theWorld;
  969.     unsigned char trap_type, tool_trap = 2;
  970.     
  971.     SysEnvirons(1, &theWorld);
  972.     
  973.     return( NGetTrapAddress( WNE_TRAP_NUM, ToolTrap ) !=
  974.                 NGetTrapAddress( UNIMPL_TRAP_NUM, ToolTrap ) );
  975.  
  976. }
  977.  
  978. /*****************************************************************/
  979. /*********************** GetFucked *******************************/
  980. /*****************************************************************/
  981. /************** Comes from "This is Fucked" **********************/
  982. /*****************************************************************/        
  983.  
  984.  
  985. WindowPtr    get_window(short    selector)    /*    -----------------------------+    */
  986. {
  987.     short            n;
  988.     char            window_number[21],    local_str[255];
  989.     char            *char_ptr, *str_ptr;
  990.     StringHandle    title_hndl;
  991.     WObjsHandle        w_objs_hndl;
  992.     WPObjsHandle    wp_objs_hndl;
  993.     
  994.     /*** Find available window pointer in our list ***/
  995.     
  996.     n = 1;
  997.     while( (gMy_windows[n] != NIL) && (n <= MY_WINDOW_MAX + 1) ) n++;
  998.     
  999.     if    ( n > MY_WINDOW_MAX    )
  1000.     {
  1001.         #ifdef      powerc
  1002.             StopAlert(OUT_OF_WNDWS,    (UniversalProcPtr)NIL);
  1003.         #else
  1004.             StopAlert(OUT_OF_WNDWS,    NIL);
  1005.         #endif      /* powerc */
  1006.         return(NIL);        /* when window not allocated */
  1007.     }
  1008.  
  1009.     /*** if there is room, create a window ***/
  1010.     
  1011.     
  1012.     gMy_windows[n] = make_circle_window(selector);    /*    <--------------------+    */
  1013.     
  1014.     /* return NIL if problem creating window */
  1015.     
  1016.     if(gMy_windows[n] == NIL)
  1017.     {
  1018.         return(NIL);
  1019.     }
  1020.     
  1021.     gWindow_count++;
  1022.     
  1023.     SetPort(gMy_windows[n]);
  1024.     
  1025.     /*** Set up the window title ***/
  1026.     
  1027.     local_str[0] = 0;
  1028.     str_ptr = local_str;
  1029.     
  1030.     title_hndl = (*(WindowPeek)gMy_windows[n]).titleHandle;
  1031.     
  1032.     MoveHHi((Handle)title_hndl);
  1033.     HLock((Handle)title_hndl);
  1034.     char_ptr = (char *) (*title_hndl);
  1035.     cat_strings(char_ptr, str_ptr, 255); /* cat_strings(source,destination,maximum) */
  1036.     HUnlock((Handle)title_hndl);
  1037.     
  1038.     str_ptr[str_ptr[0]+1] = ' ';
  1039.     str_ptr[0]++;
  1040.     
  1041.     window_number[0] = 0;
  1042.     
  1043.     char_ptr = window_number;    /* append the incremental window count */
  1044.     NumToString(gWindow_count, (StringPtr)char_ptr);
  1045.     
  1046.     cat_strings(char_ptr, str_ptr, 255); /* char_ptr is source,str_ptr is dest    */
  1047.                                          /* source is appended to dest             */
  1048.     SetWTitle(gMy_windows[n], (StringPtr)local_str);
  1049.  
  1050. /*************    Set new window name in WObjs Record, fileName        ************/
  1051.  
  1052.     w_objs_hndl = (WObjsHandle)GetWRefCon(gMy_windows[n]);
  1053.     
  1054.     HLock((Handle)w_objs_hndl);
  1055.         (**w_objs_hndl).findFile.fName[0] = 0;
  1056.         char_ptr = (char*)(&(**w_objs_hndl).findFile.fName[0]);
  1057.         cat_strings(str_ptr, char_ptr, 63);
  1058.     HUnlock((Handle)w_objs_hndl);
  1059.  
  1060.  
  1061.     /*** Position the window on the screen ***/
  1062.     
  1063.     MoveWindow(gMy_windows[n], qd.screenBits.bounds.left + (n*30),
  1064.                 qd.screenBits.bounds.top + GetMBarHeight() + 20 + (n*30), false);
  1065.  
  1066.     return(gMy_windows[n]);
  1067.     
  1068. } /* end of get_window() */    
  1069. /******************** get_rotation_box ***************************/
  1070. WindowPtr    get_rotation_box()
  1071. {
  1072.     WindowPtr        wPtr = NIL;
  1073.     WRObjsHandle    wr_objs_hndl;
  1074.     
  1075.     wPtr = GetNewWindow(ROTATION_BOX_ID,NIL, (WindowPtr) -1);
  1076.     if(wPtr == NIL)
  1077.     {
  1078.         #ifdef      powerc
  1079.             StopAlert(NO_ROTATION_BOX,    (UniversalProcPtr)NIL);
  1080.         #else
  1081.             StopAlert(NO_ROTATION_BOX,    NIL);
  1082.         #endif      /* powerc */
  1083.         return(NIL);
  1084.     }
  1085.     SetPort(wPtr);
  1086.     wr_objs_hndl = (WRObjsHandle)NewHandle(sizeof(WRObjs));
  1087.     if (wr_objs_hndl == NIL)
  1088.     {    
  1089.         DisposeWindow(wPtr);
  1090.         #ifdef      powerc
  1091.             StopAlert(OUT_OF_MEM,    (UniversalProcPtr)NIL);
  1092.         #else
  1093.             StopAlert(OUT_OF_MEM,    NIL);
  1094.         #endif      /* powerc */
  1095.         return(FALSE);
  1096.     }
  1097.         
  1098.     SetWRefCon (wPtr, (long)wr_objs_hndl);    /* set the handle into window record */    
  1099.     return(wPtr);    
  1100.  
  1101. }
  1102. /***************** end of get_rotation_box ***********************/
  1103. /********************* get_stretch_box ***************************/
  1104. WindowPtr    get_stretch_box()
  1105. {
  1106.     WindowPtr        wPtr = NIL;
  1107.     WSObjsHandle    ws_objs_hndl;
  1108.     
  1109.     wPtr = GetNewWindow(STRETCH_BOX_ID,NIL, (WindowPtr) -1);
  1110.     if(wPtr == NIL)
  1111.     {
  1112.         #ifdef      powerc
  1113.             StopAlert(NO_STRETCH_BOX,    (UniversalProcPtr)NIL);
  1114.         #else
  1115.             StopAlert(NO_STRETCH_BOX,    NIL);
  1116.         #endif      /* powerc */
  1117.         return(NIL);
  1118.     }
  1119.     SetPort(wPtr);
  1120.     ws_objs_hndl = (WSObjsHandle)NewHandle(sizeof(WSObjs));
  1121.     if (ws_objs_hndl == NIL)
  1122.     {    
  1123.         DisposeWindow(wPtr);
  1124.         #ifdef      powerc
  1125.             StopAlert(OUT_OF_MEM,    (UniversalProcPtr)NIL);
  1126.         #else
  1127.             StopAlert(OUT_OF_MEM,    NIL);
  1128.         #endif      /* powerc */
  1129.         return(FALSE);
  1130.     }
  1131.         
  1132.     SetWRefCon (wPtr, (long)ws_objs_hndl);    /* set the handle into window record */
  1133.     return(wPtr);            
  1134.  
  1135. }
  1136. /***************** end of get_stretch_box ************************/
  1137.  
  1138. /******************* make_circle_window **************************/
  1139. WindowPtr    make_circle_window(short    selector)
  1140. {
  1141.  
  1142.     short            cntrl_max, i,n;
  1143.     StringHandle    str_hndl;
  1144.     WindowPtr        wPtr = NIL;
  1145.     //WindowPtr        lastPtr;
  1146.     ControlHandle    cntrl_hndl;
  1147.     WObjsHandle        w_objs_hndl;
  1148.     WObjsHandle        last_objs_hndl;
  1149.     THPrint            print_info_hndl;
  1150.     OSErr            printerDriverError;
  1151.     short            switcher;
  1152.  
  1153.     
  1154.     if(selector == 3)
  1155.     {
  1156.         last_objs_hndl = (WObjsHandle)GetWRefCon(lastPtr);
  1157.     }
  1158.     
  1159.     wPtr = GetNewCWindow(WINDOW_ID, gPre_allocated_block, (WindowPtr) -1);
  1160.     
  1161.     if(wPtr == NIL)
  1162.     {
  1163.         #ifdef      powerc
  1164.             StopAlert(OUT_OF_WNDWS,    (UniversalProcPtr)NIL);
  1165.         #else
  1166.             StopAlert(OUT_OF_WNDWS,    NIL);
  1167.         #endif      /* powerc */
  1168.         return(NIL);
  1169.     }
  1170.  
  1171.     SetPort(wPtr);
  1172.     gPre_allocated_block = NIL;
  1173.     
  1174.     str_hndl = GetString(W_TITLE_ID);
  1175.     HLock((Handle)str_hndl);
  1176.     SetWTitle(wPtr, *str_hndl);
  1177.     HUnlock((Handle)str_hndl);
  1178.     
  1179.     w_objs_hndl = (WObjsHandle)NewHandle(sizeof(WObjs));
  1180.     if (w_objs_hndl == NIL)
  1181.     {    
  1182.         DisposeWindow(wPtr);
  1183.         #ifdef      powerc
  1184.             StopAlert(OUT_OF_MEM,    (UniversalProcPtr)NIL);
  1185.         #else
  1186.             StopAlert(OUT_OF_MEM,    NIL);
  1187.         #endif      /* powerc */
  1188.         return(FALSE);
  1189.     }
  1190.         
  1191.     SetWRefCon (wPtr, (long)w_objs_hndl);    /* set the handle into window record */        
  1192.  
  1193.     switch(selector)
  1194.     {
  1195.         case 1:
  1196.             (**w_objs_hndl).paletteSetting                = CIRCLE_OBJ;
  1197.             (**w_objs_hndl).hasBackGround                = FALSE;
  1198.             (**w_objs_hndl).gXYZplane.x_point = 200;
  1199.             (**w_objs_hndl).gXYZplane.y_point = 100;
  1200.             (**w_objs_hndl).gXYZplane.z_point = 0;
  1201.             (**w_objs_hndl).vPtNo = 0;
  1202.             (**w_objs_hndl).xvPt = 300;
  1203.             (**w_objs_hndl).yvPt = 200;
  1204.             (**w_objs_hndl).focalLn = 50;
  1205.             (**w_objs_hndl).focalPtNo = 7;
  1206.             (**w_objs_hndl).isPrey = 0;
  1207.             break;
  1208.         case 2:
  1209.             (**w_objs_hndl).paletteSetting        = PLOT_OBJ;
  1210.             (**w_objs_hndl).isPrey = 0;
  1211.             break;
  1212.         case 3:
  1213.             //(**w_objs_hndl).paletteSetting                = NO_OBJ;
  1214.             (**w_objs_hndl).gXYZplane.x_point = 200;
  1215.             (**w_objs_hndl).gXYZplane.y_point = 100;
  1216.             (**w_objs_hndl).gXYZplane.z_point = 0;
  1217.             (**w_objs_hndl).vPtNo = 0;
  1218.             (**w_objs_hndl).xvPt = 300;
  1219.             (**w_objs_hndl).yvPt = 200;
  1220.             (**w_objs_hndl).focalLn = 50;
  1221.             (**w_objs_hndl).focalPtNo = 7;
  1222.             (**w_objs_hndl).isPrey = 1;
  1223.             (**w_objs_hndl).paletteSetting = (**last_objs_hndl).paletteSetting;
  1224.             for(i = 0;i < MAX_OBJECTS;i++)
  1225.             {
  1226.                 //switcher = (**last_objs_hndl).object[i].type;
  1227.                 //switch(switcher)
  1228.                 //{
  1229.                 //    case    HOUSE_OBJ:
  1230.                 //    case    ARMD_HOUSE3_OBJ:
  1231.                 //    case    ARMD_HOUSE2_OBJ:
  1232.                 //    case    ARMD_HOUSE1_OBJ:
  1233.                 //        (**w_objs_hndl).object[i]
  1234.                 //        break;
  1235.                 //    default:
  1236.                         (**w_objs_hndl).object[i] = (**last_objs_hndl).object[i];
  1237.                 //        break;
  1238.                 //}
  1239.             }
  1240.             (**w_objs_hndl).isArmed = (**last_objs_hndl).isArmed;
  1241.             (**w_objs_hndl).targets_left = (**last_objs_hndl).targets_left;
  1242.             (**w_objs_hndl).armament_type = (**last_objs_hndl).armament_type;
  1243.             (**w_objs_hndl).arms_selected = (**last_objs_hndl).arms_selected;
  1244.             (**w_objs_hndl).hasTargets = (**last_objs_hndl).hasTargets;
  1245.             (**w_objs_hndl).hasBackGround = (**last_objs_hndl).hasBackGround;
  1246.             
  1247.             break;
  1248.     }
  1249.     (**w_objs_hndl).vDocLimit            = DOC_LENGTH;
  1250.     (**w_objs_hndl).hDocLimit            = DOC_WIDTH;
  1251.  
  1252.     (**w_objs_hndl).scrollAmount.v        = 0;
  1253.     (**w_objs_hndl).scrollAmount.h        = 0;
  1254.  
  1255.     (**w_objs_hndl).hasRealName            = FALSE;
  1256.     
  1257.     (**w_objs_hndl).findFile.good        = 0;
  1258.     (**w_objs_hndl).findFile.vRefNum    = 0;
  1259.     (**w_objs_hndl).findFile.fName[0]    = 0;
  1260.  
  1261.     (**w_objs_hndl).dirty                = FALSE;
  1262.  
  1263.  
  1264.  
  1265. /**********        Allocate and initialize the print info record            **********/
  1266.  
  1267.  
  1268. /*    print_info_hndl = (THPrint)NewHandle(sizeof(TPrint));*/
  1269. /*    if(print_info_hndl == NIL)*/
  1270. /*    {*/
  1271. /*        DisposeWindow(wPtr);*/
  1272. /*        #ifdef      powerc*/
  1273. /*            StopAlert(OUT_OF_MEM,    (UniversalProcPtr)NIL);*/
  1274. /*        #else*/
  1275. /*            StopAlert(OUT_OF_MEM,    NIL);*/
  1276. /*        #endif      /* powerc »*/
  1277. /*        return(NIL);*/
  1278. /*    }*/
  1279. /*    */
  1280. /*        */
  1281. /*    PrOpen();*/
  1282. /*    printerDriverError=PrError();*/
  1283. /*    PrintDefault( print_info_hndl );*/
  1284. /*    if(printerDriverError)*/
  1285. /*    {*/
  1286. /*        (**print_info_hndl).prInfo.rPage.right = H_RPAGE_DEFAULT;*/
  1287. /*        (**print_info_hndl).prInfo.rPage.bottom = V_RPAGE_DEFAULT;*/
  1288. /*    }*/
  1289. /*    PrClose();*/
  1290. /*    */
  1291. /*    (**w_objs_hndl).prInfoHndl = print_info_hndl;*/
  1292.  
  1293.  
  1294.  
  1295. /*************    Clear out the list of objects-in-window            ******************/
  1296.     if(selector == 3)    ;
  1297.     else    {
  1298.         for(n = 0; n < MAX_OBJECTS; n++)
  1299.         {
  1300.             (**w_objs_hndl).object[n].type  = NO_OBJ;
  1301.             (**w_objs_hndl).object[n].selected = FALSE;
  1302.         }
  1303.     }
  1304.  
  1305.     
  1306.  
  1307. /*************    Set up the vertical scrollbar            **************************/
  1308.  
  1309.  
  1310.     cntrl_hndl = GetNewControl (SCROLLBAR_ID, wPtr);
  1311.             
  1312.     if(cntrl_hndl != NIL)
  1313.     {
  1314.         MoveControl (cntrl_hndl, wPtr->portRect.right - 15, -1);
  1315.         SizeControl (cntrl_hndl, 16, wPtr->portRect.bottom - 13);
  1316.             
  1317.         cntrl_max = (**w_objs_hndl).vDocLimit 
  1318.                     - ((wPtr->portRect.bottom - 15) 
  1319.                     - wPtr->portRect.top);
  1320.                         
  1321.         if(cntrl_max < 0) cntrl_max = 0;
  1322.  
  1323.         SetCtlMax (cntrl_hndl, cntrl_max);
  1324.                 
  1325.         (**w_objs_hndl).myVCntrlHdl = cntrl_hndl;
  1326.         //SetCRefCon ((**w_objs_hndl).myVCntrlHdl, (long)0);
  1327.     }    
  1328.  
  1329.     
  1330.  
  1331. /*************    Set up the horizontal scrollbar            **************************/
  1332.  
  1333.  
  1334.     cntrl_hndl = GetNewControl (SCROLLBAR_ID, wPtr);
  1335.             
  1336.     if(cntrl_hndl != NIL)
  1337.     {
  1338.         MoveControl (cntrl_hndl, -1, wPtr->portRect.bottom - 15);
  1339.         SizeControl (cntrl_hndl, wPtr->portRect.right - 13, 16);
  1340.             
  1341.         cntrl_max = (**w_objs_hndl).hDocLimit 
  1342.                     - ((wPtr->portRect.right - 15) 
  1343.                     - wPtr->portRect.left);
  1344.                         
  1345.         if(cntrl_max < 0) cntrl_max = 0;
  1346.                         
  1347.         SetCtlMax (cntrl_hndl, cntrl_max);
  1348.                 
  1349.         (**w_objs_hndl).myHCntrlHdl = cntrl_hndl;
  1350.         SetCRefCon ((**w_objs_hndl).myHCntrlHdl, (long)0);
  1351.     }
  1352.     //if(selector == 3) GetPreyBkgrnd(wPtr);
  1353.     return(wPtr);
  1354.     
  1355. } /* end of make_circle_window() */
  1356.